library MarineSprint initializer init requires LegacySystem


	private function SprintConditions takes nothing returns boolean
		local integer i = GetSpellAbilityId()
		return i=='A000' or i=='A04N' or i=='A08I'
	endfunction

	private function Sprint takes nothing returns nothing
		local unit u = GetTriggerUnit()
		local player p = GetOwningPlayer(u)
		
		if GetUnitAbilityLevel(GetTriggerUnit(),'Bslo')>0 then
			call IssuePointOrder(u,"move",GetUnitX(u),GetUnitY(u))
			
			call DisplayTimedTextToPlayer( GetOwningPlayer(u), 0.0, 0.0, 5.0, /*
			*/ "Excess movement has worsened a fracture. Permanent loss in " + GetUnitName(u) + "'s movement speed." )
			
			call ShiftMoveSpeed(u,-25.0)
			set bj_meleeNearestMineDist = GetUnitX(u)
			set bj_lastTransmissionDuration = GetUnitY(u)
			set udg_soundpath = "Units\\Human\\Rifleman\\RiflemanDeath.wav"
			call PlaySoundPath3D.execute()
		endif

		set p = null
		set u = null
	endfunction

	private function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT  )
		call TriggerAddCondition(t,Condition(function SprintConditions))
		call TriggerAddAction(t,function Sprint)
	endfunction

endlibrary